package com.tuling.JUC;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.function.Supplier;

/**
 * @Type ThreadUtil.java
 * @Desc
 * @Author wzw
 * @Date 2024/9/10 13:41
 */
public class CallableFutuerThreadUtil {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        ThreadCallAble threadFuture = new ThreadCallAble();
        FutureTask<String> stringFutureTask = new FutureTask<>(threadFuture);

        new Thread(stringFutureTask,"A").start();

//        new Thread(new FutureTask<>(threadFuture),"B");
        String s = stringFutureTask.get();
        System.out.println(s);
    }
}
class ThreadCallAble implements Callable<String>{

    @Override
    public String call() throws Exception {
        System.out.println("uuuuuuuuu");
        return "xxxxx11";
    }
}
